package org.example.lease.model.entities;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.example.lease.model.enums.BaseStatus;

@Schema(description = "用户信息表")
@TableName(value = "user_info")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UserInfo extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @Schema(description = "手机号码（用做登录用户名）")
    @TableField(value = "phone")
    private String phone;

    /**
     * 由于密码比较特殊，查询的时候设置 select = false 直接不可见，使用mp自带的查询不能查询密码
     * 如果查询到的用户的密码字段是null，使用这个设置不能用这个来作为密码验证
     * 如果使用自定义的sql就能查询到密码
     * 也可以使用显式指定查询的字段是哪个---也能查询出password结果
     * UserInfo userInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
     * .eq(UserInfo::getPhone, phone)
     * .select(UserInfo::getPhone, UserInfo::getNickname, UserInfo::getPassword));
     */
    @Schema(description = "密码")
    @TableField(value = "password", select = false)
    private String password;

    @Schema(description = "头像url")
    @TableField(value = "avatar_url")
    private String avatarUrl;

    @Schema(description = "昵称")
    @TableField(value = "nickname")
    private String nickname;

    @Schema(description = "账号状态")
    @TableField(value = "status")
    private BaseStatus status;


}